import yaml
from openapi_core import create_spec
from openapi_core.schema.specs.models import Spec

# 读取 YAML 文件
with open('openapi.yaml', 'r', encoding='utf-8') as file:
    spec_dict = yaml.safe_load(file)

# 创建 OpenAPI 规范
spec = create_spec(spec_dict)

# 访问 TreeNode schema
tree_node_schema = spec.components.schemas['TreeNode']
print(tree_node_schema)